package com.snail.convert;

import com.snail.dto.OrderDto;
import com.snail.entity.OrderMaster;
import org.springframework.beans.BeanUtils;

import java.util.List;
import java.util.stream.Collectors;

/**
 * @Author 【swg】.
 * @Date 2017/12/8 16:22
 * @DESC
 * @CONTACT 317758022@qq.com
 */
public class OrderMaster2OrderDTOConverter {
    public static OrderDto convert(OrderMaster orderMaster) {

        OrderDto orderDto = new OrderDto();
        BeanUtils.copyProperties(orderMaster, orderDto);
        return orderDto;
    }

    public static List<OrderDto> convert(List<OrderMaster> orderMasterList) {
        return orderMasterList.stream().map(e ->
                convert(e)
        ).collect(Collectors.toList());
    }
}
